﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using KingRoad.EPM.PersonnelLogEntity.Model;
using Unis.Framework.Core.Utility;
using KingRoad.EPM.PersonnelLogDAL.ScmAssessmentscoreService;


namespace KingRoad.EPM.PersonnelLogBLL.UIRules
{
    /// <summary> 
    /// 客户端业务处理类。 
    /// 文件生成时间 2017/2/5 15:31:28
    /// </summary> 
    public class ScmAssessmentscoreUIRule
    {
        private readonly IScmAssessmentscoreService _scmAssessmentscoreService;
        
        
        public ScmAssessmentscoreUIRule(){}
        
        /// <summary> 
        /// construct function... 
        /// </summary> 
        public ScmAssessmentscoreUIRule(IScmAssessmentscoreService  scmAssessmentscoreService)
        {
           _scmAssessmentscoreService=scmAssessmentscoreService;
        }
        /// <summary>
        /// 根据安全考核ID、被考核单位ID获取安全考核项目设置及打分情况
        /// </summary>
        /// <param name="sa_id">安全考核ID</param>
        /// <param name="au_id">被考核单位ID</param>
        /// <param name="include">是否包含("0"=所以被排除的项目,"1"=所有包含的项目,"0,1"=所有项目)</param>
        /// <returns></returns>
        public List<ScmAssessmentscoreInfo> GetAssessmentscoreBySaAuID(string sa_id,string au_id,string include)
        {
            string sql = " 1=1 ";
            if (sa_id != "")
                sql += " and Sa_ID='" + sa_id + "' ";
            if (au_id != "")
                sql += " and Au_ID='" + au_id + "' ";
            sql += " and As_Include in (" + include + ") ";
            var list = _scmAssessmentscoreService.GetEntityList(sql);
            return list;
        }
        /// <summary>
        /// 添加安全考核项目设置及打分情况
        /// </summary>
        /// <param name="info">安全考核项目设置及打分信息</param>
        /// <returns></returns>
        public int AddAssessmentscore(ScmAssessmentscoreInfo info)
        {
            return _scmAssessmentscoreService.InsertEntity(info);
        }
        /// <summary>
        /// 修改安全考核项目设置及打分情况
        /// </summary>
        /// <param name="info">安全考核项目设置及打分信息</param>
        /// <returns></returns>
        public int EditAssessmentscore(ScmAssessmentscoreInfo info)
        {
            return _scmAssessmentscoreService.UpdateEntity(info);
        }
        /// <summary>
        /// 根据考核主键删除考核得分信息
        /// </summary>
        /// <param name="sa_id">安全考核主键</param>
        /// <returns></returns>
        public int DeleteAssessmentscoreBySaID(string sa_id)
        {
            return _scmAssessmentscoreService.DeleteAssessmentscoreBySaID(sa_id);
        }
    }
}

